import * as api from '.';

const cityApi = {

  find: async (id: string) => {
    return api.GET('/api/city/find/:id', { id }, null);
  },

  findAll: async () => {
    return api.GET('/api/city/findAll', null, null);
  },

  findCities: async (parentId: string) => {
    return api.GET('/api/city/query/:parentId', { parentId }, null);
  },

  query: async (keyword: string, parentId: string, pageNumber: number, pageSize: number) => {
    const data = {
      keyword,
      parentId,
      pageNumber,
      pageSize
    };
    return api.GET('/api/city/query', null, data);
  },

  save: async (data: any) => {
    return api.POST('/api/city/save', null, data);
  },

  delete: async (id: string) => {
    return api.DELETE('/api/city/delete/:id', { id }, null);
  }

};

export default cityApi;
